package com.itheima.app.interceptor;

import com.itheima.domain.db.User;

/**
 * 创建ThreadLocal对象
 * @author zsk
 * @create 2022-03-14-19:19
 */
public class UserHolder {

    private static final ThreadLocal<User> THREAD_LOCAL = new ThreadLocal<>();

    //设置User
    public static void set(User user){
        THREAD_LOCAL.set(user);
    }
    //获取User
    public static User get(){
        return THREAD_LOCAL.get();
    }

    //删除User
    public static void remove(){
        THREAD_LOCAL.remove();
    }
}
